import req from '@/utils/fetch'
// export 的另一种写法
// export const getToken=(username,password)=>{
// }

export const login = (data) =>{return req.post("/api/admin/login", data)}
export const getAdminInfo = (data) =>{return req.get("/api/admin/getLoginInfo", data)}

export const userList=(data)=>{return req.get('/api/news',data)}
export const createUser=(data)=>{return req.post('/api/user',data)}

export const articlePage = (data)=>{return req.get('/api/article',data)}

// export const getAdminInfo = (data)=>{return req.get('/api/article',data)}

// 首页
export const sevenDayCount = () =>{return req.get("/api/article/statistics/sevenDayCount",{})}
// 今日发布文章数量
export const todayArticleCount = ()=>{return req.get('/api/article/statistics/todayCount',{})}

// user
// 获取用户总数
export const getUserCount = (data)=>{return req.get('/api/user/count', data)}
export const getUserList = (data)=>{return req.get('/api/user/query', data)}
// 修改用户信息
export const updateUser = (data) =>{return req.put('/api/user', data)}
// 查询用户
// export const searchUser = (data) =>{return req.get("/api/user/search",data)}
// 查询用户名是否存在
export const isExistsLoginName = (data) =>{return req.get("/api/user/checkLoginName", data)}
// 上传头像
export const uploadImg = (data) =>{return req.post("/api/user/upload/post", data)}
export const updateImg = (data) =>{return req.post("/api/user/updateImg", data)}
export const createAdmin = (data) =>{return req.post("/api/admin", data)}
// 学校搜索,前20个
export const searchSchool = (data) =>{return req.get("/api/school/search", data)}


// 大纲
export const getOutlineCount = (data) =>{return req.get("/api/outline/allCount", data)}
export const getOutlineList = (data) =>{return req.get("/api/outline/queryAll", data)}
export const getOutlineById = (data) =>{return req.get("/api/outline/"+data.id)}
export const searchCouse = (data) =>{return req.get("/api/course/search",data)}
export const passOutline = (data) =>{return req.post('/api/outline/pass',data)}

// 年级
export const getGrades = () =>{return req.get("/api/grade")}

// 课程
export const getCourseCount = (data)=>{return req.get("/api/course/count", data)}
export const getCourseList = (data) =>{return req.get("/api/course/query",data)}
export const updateCourse = (data) =>{return req.put('api/course',data)}
export const isExistsCourseName = (data) =>{return req.get('/api/course/checkName', data)}
export const createCourse = (data) =>{return req.post('/api/course', data);}
